<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('超限记录列表')" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
	<style type="text/css">
		.table {table-layout:fixed;}
	</style>
</head>
<body class="gray-bg">
	<div class="ui-layout-center">
		<div class="container-div">
			<div class="row">
				<form id="user-form" th:object="${data}">
		        <input type="hidden" id="groupid" name="groupid" th:field="*{groupid}">
		        <input type="hidden" id="startDate" name="startDate" th:field="*{startDate}">
		        <input type="hidden" id="endDate" name="endDate" th:field="*{endDate}">
		        <input type="hidden" id="tagid" name="tagid" th:field="*{tagid}">
		        <input type="hidden" id="dutyid" name="dutyid" th:field="*{dutyid}">
		        <input type="hidden" id="identify" name="identify" th:field="*{identify}">
		        <input type="hidden" id="tagname" name="tagname" th:field="*{tagname}">
					</form>
				
        <div class="col-sm-12 select-table table-striped">
					<table id="bootstrap-table"></table>
				</div>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: layout-latest-js" />
	<th:block th:include="include :: ztree-js" />
	<script th:inline="javascript">
		var queryFlag = [[${@permission.hasPermi('overrun:tagcount:list')}]];
    var prefix = ctx + "overrun/tagcount";
		
		$(function() {
		    var panehHidden = false;
		    if ($(this).width() < 769) {
		        panehHidden = true;
		    }
		    $('body').layout({ initClosed: panehHidden, west__size: 185 });
		    queryRecordList();
		});

		function queryRecordList() {
		    var options = {
		    	url: prefix + "/countdtl",
          modalName: "超限记录",
          columns: [{
              checkbox: true
          },
          {
              field : 'groupid', 
              title : '测点分组id',
              visible: false
          },
          {
              field : 'groupname', 
              title : '测点分组名称',
              width : 150
          },
          {
              field : 'tagid', 
              title : '测点id',
              visible: false
          },
          {
              field : 'tagname', 
              title : '测点名称',
              width : 200
          },
          {
              field : 'dutyname', 
              title : '轮值名称',
              width : 200,
              align: 'center'
          },
          {
              field : 'teamname', 
              title : '轮值班组',
              width : 100,
              align: 'center'
          },
          {
              field : 'times', 
              title : '超限时长(分)',
              width : 120,
              align: 'center'
          },
          {
              field : 'counts', 
              title : '超限次数',
              width : 120,
              align: 'center'
          },
          {
        	  title: '操作',
        	  width : 150,
            align: 'center',
            formatter: function(value, row, index) {
                var actions = [];
                actions.push('<a class="btn btn-primary btn-xs ' + queryFlag + '" href="javascript:void(0)" onclick="viewDetail(\'' + row.dutyid + '\',\'' + row.identify + '\',\'' + row.tagid + '\',\'' + row.tagname + '\')"><i class="fa fa-remove"></i>记录明细</a>');
                return actions.join('');
            }
          }]
		    };
		    $.table.init(options);
		}
		
		// 记录明细操作
		function viewDetail(dutyid, identify,tagid,tagname) {
			$("#dutyid").val(dutyid);
			$("#identify").val(identify);
			$("#tagid").val(tagid);
			$("#tagname").val(tagname);
			
			var params = $("#user-form").serialize();
			
			var url = ctx + 'overrun/record/toDetail?' + params;
			$.modal.openTab("超限记录明细", url);
		}
		
		$('#btnExpand').click(function() {
			$._tree.expandAll(true);
		    $(this).hide();
		    $('#btnCollapse').show();
		});
		
		$('#btnCollapse').click(function() {
			$._tree.expandAll(false);
		    $(this).hide();
		    $('#btnExpand').show();
		});
		
		$('#btnRefresh').click(function() {
			queryGroupTree();
		});
	</script>
</body>
</html>